<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="author" content="https://github.com/thelostword" />
  <title>timeline</title>
</head>
<body>
  <canvas id="Timeline"></canvas>
  <div>
    <p>current time:</p>
    <strong id="TimeValue"></strong>
  </div>

  <script type="module">
    import TimeLine, { format } from './dist/timeline.es.js';

    const timeline = new TimeLine('#Timeline', {
      fill: false,
      zoom: 4,
    });

    timeline.draw({
      currentTime: 1651827817000,
      areas: [{
        startTime: 1651827433000,
        endTime: 1651829413000,
        bgColor: '#f897aa'
      },{
        startTime: 1651829533000,
        endTime: 1651832533000,
      }],
    });

    const TimeValue = document.querySelector('#TimeValue');
    TimeValue.textContent = format(timeline.getCurrentTime(), 'YYYY-MM-DD HH:mm:ss');

    timeline.on('dragged', (timestamp) => {
      TimeValue.textContent = format(timestamp, 'YYYY-MM-DD HH:mm:ss');
    });
    console.log(timeline);
  </script>
</body>
</html>
